<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\Artcile */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="artcile-form">

    <?php $form = ActiveForm::begin([
        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'options' => ['class' => 'form-group'],
            'template' => "{label}\n<div class=\"col-sm-8\">{input}\n<span class=\"help-block m-b-none\">{error}</span></div><div class='col-sm-8 col-sm-offset-2'>{hint}</div>",
            'labelOptions' => ['class' => 'col-sm-2 control-label'],
        ]
    ]);

    ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'content')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'status')->dropDownList([1 => "草稿", 2 => "发布",3=>'归档'],['prompt'=>'请选择文章状态']) ?>
<?php
 $obj=\common\models\Member::find()->all();
?>
    <?= $form->field($model, 'member_id')->dropDownList(\yii\helpers\ArrayHelper::map($obj,'id','username'),['prompt'=>'请选择作者']) ?>

    <div class="form-group">
        <div class="col-sm-4 col-sm-offset-2">
            <?= Html::submitButton($model->isNewRecord ? '保存' : '保存', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
        </div>
    </div>
    </div>

    <?php ActiveForm::end(); ?>

</div>
